home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.lang.c
- Subject: Re: Does Borland C++ 5.0 still work with normal C???
- Date: Mon, 19 Feb 1996 22:48:45 GMT
- Organization: Netcom
- Message-ID: <3128ef57.265162433@nntp.ix.netcom.com>
- References: <n4mwd.33.000A228B@magg.net> <4gag3n$a5u@wormer.fn.net>
- NNTP-Posting-Host: ix-dc21-23.ix.netcom.com
- X-NETCOM-Date: Mon Feb 19 2:48:01 PM PST 1996
- X-Newsreader: Forte Agent .99d/32.182
-
- joakley@wichita.fn.net (Jess J Oakley) wrote:
-
- > n4mwd@magg.net (Dennis Hawkins) wrote:
- >
- > >Does anybody know if the new Borland C++ compiler will compile normal C?? In
- > >my opinion, if it doesn't, it is worthless. I recently received a flyer from
- > >Borland and there was no mention of being able to compile C.
- >
- > Probably so, Since as far as I know anything written in C is legal
- > within a C++ program. Obviously it wouldn't be a "TRUE"
- > C++ program.
-
- This just isn't true. For example, the following is legal C but not
- C++:
-
- #include <stdlib.h>
-
- int main()
- {
- int* a = malloc(10 * sizeof a);
- return 0;
- }
-
- There are also constructions that have different meanings in C and
- C++. For example,
-
- #include <stdio.h>
-
- int main()
- {
- printf("%ld\n", (long) sizeof 'a');
- return 0;
- }
-
- will print 1 in C++ but probably not in C (in C it will only if an int
- is the same size as char -- I'd be shocked if this is true in any
- Borland compiler).
-
-
- Michael M Rubenstein
-